import kivy
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.factory import Factory


class Arachne(Widget):
    def addPlace(self, addTo, pos):
        print pos
        with addTo.canvas:
            pl = Place()
            r = pl.size[0] / 2
            pl.pos = (pos[0] - r, pos[1] - r)

    def addTrans(self, addTo, pos):
        print pos
        with addTo.canvas:
            tr = Transition()
            s = tr.size[0] / 2
            tr.pos = (pos[0] - s, pos[1] - s)

class Place(Widget):
    pass

Factory.register("Place", Place)

class Transition(Widget):
    pass

Factory.register("Transition", Transition)

class ArachneApp(App):
    def build(self):
        return Arachne()

if __name__ == '__main__':
    ArachneApp().run()
